﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;
using log4net;

namespace GrayParrot.Infrastructure
{
    public class FacadeBase
    {
        private Exception m_lastException = null;

        public Exception LastException
        {
            get { return m_lastException; }
            set { m_lastException = value; }
        }

        public FacadeBase()
        {

        }

        //public void WithTransaction(Action action)
        //{
        //    WithLog(() => {
            
        //        using(TransactionScope scope = new TransactionScope())
        //        {
        //            action();

        //            scope.Complete();
        //        }
            
        //    });
        //}

        //public void WithLog(Action action)
        //{
        //    try
        //    {
        //        action();
        //    }
        //    catch (Exception ex)
        //    {
        //        m_lastException = ex;

        //        GrayParrot.Logging.Logger.For<T>().DebugFormat("{0}\n\n{1}", ex.Message, ex.StackTrace);
        //    }
        //}
    }
}
